# -*- coding: utf-8 -*-
import scrapy
from scrapy.http import request


class ZhilianIndexSpider(scrapy.Spider):
    name = 'zhilian_index'
    allowed_domains = ["douban.com/"]
    # start_urls = ['http://www.zhilian.com/']

    custom_settings = {
        "USER_AGENT": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 Safari/537.36",
    }

    def start_requests(self):
        yield scrapy.Request(url='https://accounts.douban.com/j/mobile/login/basic', meta={'cookiejar': 1}, callback=self.parse)

    def parse(self, response):
        data = {
            'name': '1210999688@qq.com',
            'password': 'tusbasa1',
        }

        yield scrapy.Request(
            url='https://accounts.douban.com/j/mobile/login/basic',  # 真实post地址
            # meta={'cookiejar': response.meta['cookiejar']},
            # body=data,
            callback=self.next,
            # method='POST'
        )

    def next(self, response):
        y = response

        x = 1
